package com.learn.yu.proxy.dynamic.cglib;

import org.springframework.cglib.proxy.MethodInterceptor;
import org.springframework.cglib.proxy.MethodProxy;

import java.lang.reflect.Method;

/**
 * @author : Yu.Tan
 * @date : 2023/6/21 17:09
 * @desc : **
 */
public class MyMethodInterceptor implements MethodInterceptor {
    @Override
    public Object intercept(Object o, Method method, Object[] objects, MethodProxy methodProxy) throws Throwable {
        System.out.println("开始对目标类进行增强");
        //注意这里的方法调用，不是用反射哦！！！
        return methodProxy.invokeSuper(o, objects);
    }
}
